/*
* @Author: monster
* @Date:   2017-09-21 15:59:27
* @Last Modified by:   monster
* @Last Modified time: 2017-09-21 23:29:38
*/
'use strict';
angular.module('app').controller('loginCtrl', ['cache', '$state', '$http', '$scope', function(cache, $state, $http, $scope){
  $scope.submit = function() {
    $http.post('data/login.json', $scope.user).success(function(resp){
      cache.put('id',resp.id);
      cache.put('name',resp.name);
      cache.put('image',resp.image);
      $state.go('main');
    });
  }
}]);
